package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.mapper.MemberMapper;
import com.itheima.pojo.Member;
import com.itheima.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

@Service(interfaceClass = MemberService.class)
public class MemberServiceImpl implements MemberService {

    @Autowired
    private MemberMapper memberMapper;

    @Override
    public Member findByTel(String telephone) {

        return memberMapper.findByTel(telephone);
    }

    @Override
    public void regist(Member member) {
        memberMapper.regist(member);
    }

    @Override
    public List<Integer> findMemberCountByMonth(List<String> list) {
        //根据日期查询
        List<Integer> monthCount = new ArrayList<>();
        for (String s : list) {
            s+=".31";
            Integer count = memberMapper.findByMonth(s);
            monthCount.add(count);
        }
        return monthCount;
    }
}
